Release 10.1A: OpenEdge Deployment:
Managing 4GL Applications
RCODE–INFO handle
The
RCODE-INFOsystem handle lets you read the r-code CRC from an r-code file. You can use this value to:
- Build a procedure security table, and then to verify the integrity of your application r-code against it.
- Automatically install database schema trigger definitions in a deployment procedure that you run in a secure context.
- Determine whether you need to recompile procedure files after a database change.
- Determine whether procedure files have changed between different versions of your application.
Getting the r-code CRC
To read the r-code CRC from an r-code file, first set the
FILE-NAMEattribute of theRCODE-INFOhandle to the pathname of your r-code file. Then read the value of theCRC-VALUEattribute:
Note: The
RCODE-INFOhandle cannot read the r-code CRC from a session compile. For source (.p) procedures, theCRC-VALUEattribute returns the Unknown value (?).Example — Verifying application r-code integrity
Be sure to verify the integrity of your application’s r-code.
![]()
To provide r-code integrity and security in your application:
- Build the procedure security table, RcodeSecurity, with these fields:
- Construct a text file,
crctable.dat, that contains a list of the relative pathnames for all the secure procedures called by your application.- Compile and save the r-code for all the secure procedures in your application.
- Run a procedure that contains code like this to build the RcodeSecurity table:
- At each point where you call a secure procedure in your application, insert this code:
Example — Deploying schema triggers
The following procedure installs new schema trigger definitions in an existing database. It reads dump files that contain the new data for table and field metaschema trigger records and updates these records with the new trigger procedure names and CRCs:
Note: As this example shows, you must use the
RECIDfunction rather than theROWIDfunction to reference metaschema table record locations.Example — Determining which files are affected by a database change
The following procedure demonstrates how you can use the
RCODE-INFOsystem handle with theTABLE-LISTandTABLE-CRC-LISTattributes to help determine which files you need to recompile based upon a database change.TABLE-LISTgenerates a list of all the database tables that are referenced in the procedure file.TABLE-CRC-LISTgenerates a list of the corresponding table CRC values stored in the compiled procedure file. This example procedure then compares the CRC values in the procedure file with those stored in the database. If any of the values differ, you get a message stating that the procedure needs to be recompiled, as shown:
This procedure does not generate any warnings or error messages. If the r-code file was not compiled with any tables then the attribute returns the empty string. If the file is not found or is corrupted, the attribute returns the Unknown value (
?).Example — Determining which files differ between application versions
The MD5 value is a 128-bit unique key that is stored within a compiled procedure. Changing one character in a procedure file results in a different MD5 value. With the
MD5-VALUEattribute for theRCODE-INFOsystem handle, you can determine which r-code files need to be replaced in your application between versions. The following example code shows the output of theMD5-VALUEattribute:
This code results in the following output:
You could create a program that runs this code for two versions of the same procedure file and then compare the resulting outputs. If they are the same, you know the contents of the procedure file has not changed between the two versions.
If you did not use the
GENERATE-MD5option on theCOMPILEstatement to compile a procedure, Progress did not store the MD5 value in the r-code file. In this case, this attribute returns the Unknown value (?).
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |